<template>
	<view>
		<nav-bar>申请详情</nav-bar>
		<view class="good-li" @click="chooseGood(good.id)">
			<u-avatar :mode="mode" :size="size" :src="'http://localhost:9090/'+ListInfo.headpic" :text="text" :showLevel="showLevel" :showSex="showSex"
				:bgColor='bgColor' class="good-img"></u-avatar>
			<view class="flex-item">
				<view class="good-name">{{ListInfo.username}}({{ListInfo.email}})</view>
				<text class="good-title">{{ListInfo.sex}}</text>
			</view>
		</view>
		<u-cell-group>
			<u-cell-item center :is-link="true" title="简历" index="index" @click="click" :arrow="arrow">

			</u-cell-item>
			<u-cell-item :border-bottom="false" value="" title="来源" :value="ListInfo.title" :arrow="false">

				<u-field slot="value"></u-field>
			</u-cell-item>
			<u-cell-item :border-bottom="false" value="" title="时间" :value="ListInfo.created_at" :arrow="false">
			
				<u-field slot="value"></u-field>
			</u-cell-item>
		</u-cell-group>
		<u-row :justify="justify" @click="rowClick" v-if="buttonStatus">
			<u-col :span="span" :offset="offset" @click="click" stop>
			<view class="btn">
				<u-button @click="btnClick(2)" data-name="2" :plain="true" size="medium" :ripple="true" :hairLine="true"
					type="default">忽略</u-button>
			</view>
			</u-col>
			<u-col :span="span" :offset="offset">
			<view class="btn">
				<u-button @click="btnClick(0)" data-name="0" :plain="true" size="medium" :ripple="true" :hairLine="true"
					type="default">拒绝</u-button>
			</view>
			</u-col>
			<u-col :span="span" :offset="offset">
			<view class="btn">
				<u-button @click="btnClick(1)" data-name="1" :plain="true" size="medium" :ripple="true" :hairLine="true"
					type="default">同意</u-button>
			</view>
			</u-col>
		</u-row>



	</view>
</template>

<script>
	export default {
		data() {
			return {
				ListInfo:{
					username:'',
					email:'',
					headpic:'',
					sex:'',
					title:'',
					created_at:'',
					form_state:'',
				},
				span: 4,
				offset: 0,
				justify: 'start',
				//头像
				mode: 'circle',
				src: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
				text: '', // 优先级比src高
				size: 'large',
				showLevel: false,
				showSex: false,
				bgColor: '#fcbd71',
				//
				arrow: true,
				rightSlot: true,
				checked: false,
				ListID:'',
				buttonStatus:1	
			}
		},
		onLoad: function (option) { //option为object类型，会序列化上个页面传递的参数
		        this.ListID=option.id
				console.log(option.id)
				
		    },
		mounted() {
			this.$api.enterprise.getRecruitmentUserInfo(this.ListID).then(res=>{
				console.log(res)
				if(res.data.code==200){
					this.ListInfo=res.data.data
					this.getResult('yyyy-mm-dd hh:MM');//日期格式化
					if(res.data.data.form_state!="未处理"){
						this.buttonStatus=0
					}
				}
				
			})
		},	
		methods: {
			btnClick(index) {
				if (index==0){
					index="不合适"
				}
				else if(index==1){
					index="已通过"
				}
				else if(index==2){
					index="被查看"
				}
				console.log(index)
				let data={
					status:index
				}
				this.$api.enterprise.processResume(data,this.ListID).then(res=>{
					console.log(res)
					if(res.data.code==200){
						this.buttonStatus=0
					}
				})
			},
			getResult(format) {
				this.ListInfo.created_at = this.$u.timeFormat(this.ListInfo.created_at, format);
			}

		}
	}
</script>

<style lang="scss">
	.good-li {
		display: flex;
		align-items: center;
		padding: 20upx;
		margin-left: 10upx;
		margin-top: 20upx;

		.good-img {
			width: 100upx;
			height: 100upx;
			margin-right: 20rpx;

		}

		.flex-item {
			flex: 1;

			.good-name {
				font-size: 40upx;
				line-height: 40upx;
				height: 80upx;
				margin-bottom: -34upx;
				overflow: hidden;
				font-weight: 600;
				margin-left: 16upx;
			}

			.good-price {
				font-size: 30upx;
				margin-left: 16upx;
				color: red;
			}

			.good-title {
				font-size: 24upx;
				margin-left: 16upx;
				color: gray;
				display: flex;
				margin-bottom: 10upx
			}
		}
	}
	// H5中，电脑端文档演示时，可能会导致演示块挤出边界，特别处理。
	// 真实使用环境不会产生此问题
	/* #ifdef H5 */
	.u-demo-area /deep/ .u-row {
		display: flex;
		flex-wrap: wrap;
	}
	/* #endif */
</style>
